<?php
namespace app\service\hash;
class Md5
{
    protected $safeSecurity;
    function __construct($safeSecurity)
    {
        $this->safeSecurity = $safeSecurity;
    }

    function generate($password)
    {
        return md5($this->safeSecurity.$password);
    }

    function check($newPassowrd,$hashPassword)
    {
        return $this->generate($newPassowrd) == $hashPassword;
    }
}